package com.wmh.baseservice.skd.mapper;

import com.wmh.baseservice.common.mybatisplus.methods.CommonMapper;
import com.wmh.baseservice.skd.pojo.SkdGoodsSpec;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author wmh generator
 * @since 2022-03-09
 */
public interface SkdGoodsSpecMapper extends CommonMapper<SkdGoodsSpec> {

    /**
     * 根据商品id获取不同商品规格的价格列表
     * @param goodsId 商品id
     * @return 返回不同商品规格的价格列表
     */
    List<SkdGoodsSpec> getPriceRangeByGoodsId(Long goodsId);
    @Select("SELECT description FROM skd_goods_spec WHERE id = #{goodsSpecId}")
    String getDescById(Long goodsSpecId);
    @Select("SELECT img_url FROM skd_goods_spec WHERE id = #{goodsSpecId}")
    String getGoodsImageUrlById(Long goodsSpecId);
    @Update("UPDATE skd_goods_spec SET deleted = 1 WHERE goods_id = #{goodsId}")
    boolean deleteByGoodsId(Long goodsId);
    @Select("SELECT price FROM skd_goods_spec WHERE id = #{goodsSpecId}")
    BigDecimal getGoodsPriceById(Long goodsSpecId);
}
